package com.futu.common.vo;

import lombok.Data;

@Data
public class ResultVo<T> {
    private Integer code;
    private String msg;
    private  T obj;
    public ResultVo(Integer code, String msg) {
        this.code=code;
        this.msg=msg;
    }
    public ResultVo() {}
    public static ResultVo success(Object object) {
        ResultVo resultVO = new ResultVo(200,"成功");
        resultVO.setObj(object);
        return resultVO;
    }
    public static ResultVo error(Object object) {
        ResultVo resultVO = new ResultVo(400,"失败");
        resultVO.setObj(object);
        return resultVO;
    }
    public static ResultVo success() {
        return success(null);
    }
    public static ResultVo error(Integer code, String msg) {
        ResultVo resultVO = new ResultVo();
        resultVO.setCode(code);
        resultVO.setMsg(msg);
        return resultVO;
    }
    public static ResultVo error(){
        ResultVo resultVO=new ResultVo();
        resultVO.setCode(0);
        resultVO.setMsg("失败");
        return resultVO;
    }
    public static ResultVo error(Integer code,String msg,Object obj){
        ResultVo resultVO=new ResultVo();
        resultVO.setCode(0);
        resultVO.setMsg(msg);
        resultVO.setObj(obj);
        return resultVO;
    }
}
